package com.hjs.servlet.regularinspection.regularinspection;

import lombok.extern.slf4j.Slf4j;

import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@WebServlet("/RegularInpection/update")
@Slf4j
public class UpdateRegularInpection extends HttpServlet {
    /**
     * 考虑放弃update方法，更新ID不应该是用户的权限
     * @param request request
     * @param response response
     */
    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) {
//        RequestUtil requestUtil = new RequestUtil(request, response);
//        Mapper<RegularInspectionMapper> regularInspectionMapperMapper = new Mapper<>(RegularInspectionMapper.class);
//        try (SqlSession sqlSession = Mapper.getSqlSession()) {
////            RegularInspectionMapper regularInspectionMapper = sqlSession.getMapper(RegularInspectionMapper.class);
////            RegularInspection regularInspection = new RegularInspection(requestUtil.getInt("regularInspectionID"),
////                    requestUtil.getInt("pavementFlatness"), requestUtil.getInt("pavementDamageComID"),
////                    requestUtil.getInt("roadwayID"),null);
////            boolean sqlResult = regularInspectionMapper.updateOneRegularInspection(regularInspection);
////            Mapper.SessionEnd(sqlResult, sqlSession,"更新定期检测失败");
////            requestUtil.responseIsSuccess(sqlResult,"成功！");
//        } catch (Exception e) {
//            log.error(e.toString());
//            requestUtil.responseFail("未知错误失败！");
//        }
    }

    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) {
        doPost(request,response);
    }
}
